<template>
  <el-container class="home-container">
    <!--头部区-->
    <el-header>
      <div>
        <img  class="img_tup" src="../assets/bti.png"  >
        <span >在线点餐后台管理系统</span>
      </div>
      <el-button type="danger" @click="out" >退出</el-button>
    </el-header>
    <!--页面主体区-->
    <el-container>
      <!--侧边栏-->
      <el-aside :width="isCollapse ? '64px' : '200px'">
        <div class="toggle-button" @click="toggle">|||</div>
        <el-menu background-color="#485358" text-color="#fff" active-text-color="#409eff" :unique-opened="true" :collapse="isCollapse" :collapse-transition="false" :router="true">
        <!-- 一级菜单 -->
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-ice-drink"></i>
            <span>档口管理</span>
          </template>
          <!-- 二级菜单 -->
          <el-menu-item index="territory">
            <i class="el-icon-milk-tea"></i>
            <span>档口列表</span>
            </el-menu-item>
        </el-submenu>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-ice-cream-round"></i>
            <span>菜品管理</span>
          </template>
          <!-- 二级菜单 -->
          <el-menu-item index="food">
            <i class="el-icon-potato-strips"></i>
            <span>菜品列表</span>
            </el-menu-item>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
            <i class="el-icon-s-custom"></i>
            <span>用户管理</span>
          </template>
          <!-- 二级菜单 -->
          <el-menu-item index="user">
            <i class="el-icon-user-solid"></i>
            <span></span>用户列表</el-menu-item>
        </el-submenu>
        <el-submenu index="4">
          <template slot="title">
            <i class="el-icon-s-home"></i>
            <span>社区管理</span>
          </template>
          <!-- 二级菜单 -->
          <el-menu-item index="community">
            <i class="el-icon-s-help"></i>
            <span>社区列表</span></el-menu-item>
        </el-submenu>
        <el-submenu index="5">
          <template slot="title">
            <i class="el-icon-star-on"></i>
            <span>首页管理</span>
          </template>
          <!-- 二级菜单 -->
          <el-menu-item index="homepage">
            <i class="el-icon-menu"></i>
            <span></span>首页管理</el-menu-item>
        </el-submenu>
      </el-menu>
      </el-aside>
      <!--右侧内容主体-->
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data () {
    return {
      // 默认不折叠
      isCollapse: false
    }
  },
  methods:{
    //
    toggle(){
      this.isCollapse = !this.isCollapse
    },
    out () {
      this.$message({message: '退出成功',type: 'success',center: true});
      this.$router.push('/login')
    },
  }
}
</script>
<style lang="less" scoped>
.home-container{
  height: 100%;
}
.el-header{
  background-color: #0097FF;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  align-items: center;
  color: #ffffff;
  font-size: 23px;
  >div{
    display: flex;
    align-items: center;
    span{
      margin-left: 15px;
    }
  }
}
.el-aside{
  background-color: #485358;
  .el-menu{
    border-right: none;
  }
}
.el-main{
  background-color: #EAEDF1;
}
.img_tup{
  height: 30%;
  width: 20%;
}
.toggle-button{
  background-color: #4a5064;
  font-size: 10px;
  line-height: 24px;
  color: #fff;
  text-align: center;
  letter-spacing: 0.2em;
  cursor: pointer;
}
</style>
